#!/bin/bash

source /etc/profile

workdir=$(cd $(dirname $0); pwd)

hive_url="jdbc:hive2://cdh002:10000/default"

beeline -u "$hive_url" -f $workdir/device_pool.sql

if [ "$?" -ne "0" ]
then
	echo "deveice pool execute error"
	exit 1
fi

beeline -u "$hive_url" -e "alter table dws.device_pool rename to dws.device_pool_bak; alter table dws.device_pool_temp rename to dws.device_pool; drop table if exists dws.device_pool_bak;"



